<?php

//脚本目录
define('ROOT', $_SERVER['DOCUMENT_ROOT']);

//载入文件
require_once ROOT.'config/config.php';
require_once MODEL.'model_mongo.php';

$conn   =  new Mongo($config['mongo']['connect']);
$db     =  $conn->selectDB('local');
$mongo  =  new MongoCollection($db, 'testforlocal');

$criteria   =  array('title'=>'Test for local mongoDB');
#$data       =  array('time'=>time(), 'views'=>1, 'title'=>'Test for local mongoDB', 'user'=>'lishihai');
#$data_inc   =  array('$inc'=>array('views'=>1));
#$data_set   =  array('$set'=>array('time'=>time()));
$data_unset =  array('$unset'=>'date');
#$data_push   =  array('$push'=>array('date'=>date('Y-m-d H:i:s')));
#$options    =  array('safe'=>true,'upsert'=>false);

#$mongo->insert($data);
#$mongo->update($criteria, $data_inc);
#$mongo->update($criteria, $data_set, $options);
$mongo->update($criteria, $data_unset);

print_r('<pre>');
print_r($mongo->findOne($criteria));


#$mongo = new model_mongo($config['mongo']['connect'], 'local', 'testforlocal');
